var app = angular.module("quesApp", []);
app.controller("quesCtr", function($scope) {
	//调用接口，获取后台数据
	$scope.datasourse =httpServer.getcontent();
	$scope.perpage = [];
	$scope.pagenum = 0;
	for(var i = 0; i < $scope.datasourse.length; i += 3) {
		$scope.perpage.push($scope.datasourse.slice(i, i + 3));
	}
	//删除题库题目
	$scope.del = function(num) {
		for(var i = 0; i < $scope.datasourse.length; i++) {
			if($scope.datasourse[i].id == num) {
				$scope.datasourse.splice(i, 1);
				$scope.perpage = [];
				for(var i = 0; i < $scope.datasourse.length; i += 3) {
					$scope.perpage.push($scope.datasourse.slice(i, i + 3));
				}
				break;
			} else {
				continue;
			}
		}
	}
	//点选分页
	$scope.paging=function(num){
		$scope.pagenum=num;
	}
	//上一页执行函数
	$scope.down=function(){
		$scope.pagenum--;
	}
	//下一页执行函数
    $scope.up=function(){
    	$scope.pagenum++;
    }
})